<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang = "en">

<head>

<link rel="shortcut icon" href="http://algs4.cs.princeton.edu/favicon.ico">
<link rel="stylesheet"    href="http://algs4.cs.princeton.edu/java.css" type="text/css">

<title>Interval2D.java</title>

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<meta NAME="AUTHOR" CONTENT="Robert Sedgewick and Kevin Wayne">
<meta NAME="DESCRIPTION" CONTENT="Interval2D code in Java">
<meta NAME="TITLE" CONTENT="Interval2D code in Java">
<meta NAME="KEYWORDS" CONTENT="Interval2D,java,programming,computer science,algorithm,data structure,program,code">
<meta NAME="ROBOTS" CONTENT="INDEX,FOLLOW">

</head>


<body>
<center><h1>Interval2D.java</h1></center><p><br>

Below is the syntax highlighted version of <a href = "Interval2D.java">Interval2D.java</a>.
<p><br>

<!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span class="comment">/******************************************************************************</span>
<span class="comment"> *  Compilation:  javac Interval2D.java</span>
<span class="comment"> *  Execution:    java Interval2D</span>
<span class="comment"> *  Dependencies: StdOut.java Interval1D.java StdDraw.java</span>
<span class="comment"> *  </span>
<span class="comment"> *  2-dimensional interval data type.</span>
<span class="comment"> *</span>
<span class="comment"> ******************************************************************************/</span>

<span class="preproc">package</span><span class="normal"> edu</span><span class="symbol">.</span><span class="normal">princeton</span><span class="symbol">.</span><span class="normal">cs</span><span class="symbol">.</span><span class="normal">algs4</span><span class="symbol">;</span>

<span class="comment">/**</span>
<span class="comment"> *  The </span><span class="keyword">&lt;tt&gt;</span><span class="comment">Interval2D</span><span class="keyword">&lt;/tt&gt;</span><span class="comment"> class represents a closed two-dimensional interval,</span>
<span class="comment"> *  which represents all points (x, y) with both xmin &lt;= x &lt;= xmax and</span>
<span class="comment"> *  ymin &lt;= y &lt;= ymax.</span>
<span class="comment"> *  Two-dimensional intervals are immutable: their values cannot be changed</span>
<span class="comment"> *  after they are created.</span>
<span class="comment"> *  The class </span><span class="keyword">&lt;code&gt;</span><span class="comment">Interval2D</span><span class="keyword">&lt;/code&gt;</span><span class="comment"> includes methods for checking whether</span>
<span class="comment"> *  a two-dimensional interval contains a point and determining whether</span>
<span class="comment"> *  two two-dimensional intervals intersect.</span>
<span class="comment"> *  </span><span class="keyword">&lt;p&gt;</span>
<span class="comment"> *  For additional documentation, </span>
<span class="comment"> *  see </span><span class="keyword">&lt;a</span><span class="normal"> </span><span class="type">href</span><span class="symbol">=</span><span class="string">"http://algs4.cs.princeton.edu/12oop"</span><span class="keyword">&gt;</span><span class="comment">Section 1.2</span><span class="keyword">&lt;/a&gt;</span><span class="comment"> of </span>
<span class="comment"> *  </span><span class="keyword">&lt;i&gt;</span><span class="comment">Algorithms, 4th Edition</span><span class="keyword">&lt;/i&gt;</span><span class="comment"> by Robert Sedgewick and Kevin Wayne. </span>
<span class="comment"> *</span>
<span class="comment"> *  </span><span class="type">@author</span><span class="comment"> Robert Sedgewick</span>
<span class="comment"> *  </span><span class="type">@author</span><span class="comment"> Kevin Wayne</span>
<span class="comment"> */</span>
<span class="keyword">public</span><span class="normal"> </span><span class="keyword">class</span><span class="normal"> </span><span class="classname">Interval2D</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="keyword">private</span><span class="normal"> </span><span class="keyword">final</span><span class="normal"> </span><span class="usertype">Interval1D</span><span class="normal"> x</span><span class="symbol">;</span>
<span class="normal">    </span><span class="keyword">private</span><span class="normal"> </span><span class="keyword">final</span><span class="normal"> </span><span class="usertype">Interval1D</span><span class="normal"> y</span><span class="symbol">;</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Initializes a two-dimensional interval.</span>
<span class="comment">     * </span><span class="type">@param</span><span class="comment"> x the one-dimensional interval of x-coordinates</span>
<span class="comment">     * </span><span class="type">@param</span><span class="comment"> y the one-dimensional interval of y-coordinates</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="function">Interval2D</span><span class="symbol">(</span><span class="usertype">Interval1D</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">Interval1D</span><span class="normal"> y</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="keyword">this</span><span class="symbol">.</span><span class="normal">x </span><span class="symbol">=</span><span class="normal"> x</span><span class="symbol">;</span>
<span class="normal">        </span><span class="keyword">this</span><span class="symbol">.</span><span class="normal">y </span><span class="symbol">=</span><span class="normal"> y</span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Does this two-dimensional interval intersect that two-dimensional interval?</span>
<span class="comment">     * </span><span class="type">@param</span><span class="comment"> that the other two-dimensional interval</span>
<span class="comment">     * </span><span class="type">@return</span><span class="comment"> true if this two-dimensional interval intersects</span>
<span class="comment">     *    that two-dimensional interval; false otherwise</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="type">boolean</span><span class="normal"> </span><span class="function">intersects</span><span class="symbol">(</span><span class="usertype">Interval2D</span><span class="normal"> that</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="keyword">this</span><span class="symbol">.</span><span class="normal">x</span><span class="symbol">.</span><span class="function">intersects</span><span class="symbol">(</span><span class="normal">that</span><span class="symbol">.</span><span class="normal">x</span><span class="symbol">))</span><span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">false</span><span class="symbol">;</span>
<span class="normal">        </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="keyword">this</span><span class="symbol">.</span><span class="normal">y</span><span class="symbol">.</span><span class="function">intersects</span><span class="symbol">(</span><span class="normal">that</span><span class="symbol">.</span><span class="normal">y</span><span class="symbol">))</span><span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">false</span><span class="symbol">;</span>
<span class="normal">        </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">true</span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Does this two-dimensional interval contain the point p?</span>
<span class="comment">     * </span><span class="type">@param</span><span class="comment"> p the two-dimensional point</span>
<span class="comment">     * </span><span class="type">@return</span><span class="comment"> true if this two-dimensional interval contains the point p; false otherwise</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="type">boolean</span><span class="normal"> </span><span class="function">contains</span><span class="symbol">(</span><span class="usertype">Point2D</span><span class="normal"> p</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="keyword">return</span><span class="normal"> x</span><span class="symbol">.</span><span class="function">contains</span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">.</span><span class="function">x</span><span class="symbol">())</span><span class="normal">  </span><span class="symbol">&amp;&amp;</span><span class="normal"> y</span><span class="symbol">.</span><span class="function">contains</span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">.</span><span class="function">y</span><span class="symbol">());</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Returns the area of this two-dimensional interval.</span>
<span class="comment">     * </span><span class="type">@return</span><span class="comment"> the area of this two-dimensional interval</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="type">double</span><span class="normal"> </span><span class="function">area</span><span class="symbol">()</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="keyword">return</span><span class="normal"> x</span><span class="symbol">.</span><span class="function">length</span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> y</span><span class="symbol">.</span><span class="function">length</span><span class="symbol">();</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">        </span>
<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Returns a string representation of this two-dimensional interval.</span>
<span class="comment">     * </span><span class="type">@return</span><span class="comment"> a string representation of this two-dimensional interval</span>
<span class="comment">     *    in the form [xmin, xmax] x [ymin, ymax]</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="usertype">String</span><span class="normal"> </span><span class="function">toString</span><span class="symbol">()</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="keyword">return</span><span class="normal"> x </span><span class="symbol">+</span><span class="normal"> </span><span class="string">" x "</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> y</span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Does this interval equal the other interval?</span>
<span class="comment">     * </span><span class="type">@param</span><span class="comment"> other the other interval</span>
<span class="comment">     * </span><span class="type">@return</span><span class="comment"> true if this interval equals the other interval; false otherwise</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="type">boolean</span><span class="normal"> </span><span class="function">equals</span><span class="symbol">(</span><span class="usertype">Object</span><span class="normal"> other</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">other </span><span class="symbol">==</span><span class="normal"> </span><span class="keyword">this</span><span class="symbol">)</span><span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">true</span><span class="symbol">;</span>
<span class="normal">        </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">other </span><span class="symbol">==</span><span class="normal"> </span><span class="keyword">null</span><span class="symbol">)</span><span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">false</span><span class="symbol">;</span>
<span class="normal">        </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">other</span><span class="symbol">.</span><span class="function">getClass</span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">!=</span><span class="normal"> </span><span class="keyword">this</span><span class="symbol">.</span><span class="function">getClass</span><span class="symbol">())</span><span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">false</span><span class="symbol">;</span>
<span class="normal">        </span><span class="usertype">Interval2D</span><span class="normal"> that </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">Interval2D</span><span class="symbol">)</span><span class="normal"> other</span><span class="symbol">;</span>
<span class="normal">        </span><span class="keyword">return</span><span class="normal"> </span><span class="keyword">this</span><span class="symbol">.</span><span class="normal">x</span><span class="symbol">.</span><span class="function">equals</span><span class="symbol">(</span><span class="normal">that</span><span class="symbol">.</span><span class="normal">x</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">&amp;&amp;</span><span class="normal"> </span><span class="keyword">this</span><span class="symbol">.</span><span class="normal">y</span><span class="symbol">.</span><span class="function">equals</span><span class="symbol">(</span><span class="normal">that</span><span class="symbol">.</span><span class="normal">y</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal"> </span>
<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Returns an integer hash code for this interval.  </span>
<span class="comment">     * </span><span class="type">@return</span><span class="comment"> an integer hash code for this interval </span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="type">int</span><span class="normal"> </span><span class="function">hashCode</span><span class="symbol">()</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="type">int</span><span class="normal"> hash1 </span><span class="symbol">=</span><span class="normal"> x</span><span class="symbol">.</span><span class="function">hashCode</span><span class="symbol">();</span>
<span class="normal">        </span><span class="type">int</span><span class="normal"> hash2 </span><span class="symbol">=</span><span class="normal"> y</span><span class="symbol">.</span><span class="function">hashCode</span><span class="symbol">();</span>
<span class="normal">        </span><span class="keyword">return</span><span class="normal"> </span><span class="number">31</span><span class="symbol">*</span><span class="normal">hash1 </span><span class="symbol">+</span><span class="normal"> hash2</span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Draws this two-dimensional interval to standard draw.</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="type">void</span><span class="normal"> </span><span class="function">draw</span><span class="symbol">()</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="type">double</span><span class="normal"> xc </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">x</span><span class="symbol">.</span><span class="function">min</span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> x</span><span class="symbol">.</span><span class="function">max</span><span class="symbol">())</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2.0</span><span class="symbol">;</span>
<span class="normal">        </span><span class="type">double</span><span class="normal"> yc </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">y</span><span class="symbol">.</span><span class="function">min</span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> y</span><span class="symbol">.</span><span class="function">max</span><span class="symbol">())</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2.0</span><span class="symbol">;</span>
<span class="normal">        StdDraw</span><span class="symbol">.</span><span class="function">rectangle</span><span class="symbol">(</span><span class="normal">xc</span><span class="symbol">,</span><span class="normal"> yc</span><span class="symbol">,</span><span class="normal"> x</span><span class="symbol">.</span><span class="function">length</span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2.0</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">.</span><span class="function">length</span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2.0</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">    </span><span class="comment">/**</span>
<span class="comment">     * Unit tests the </span><span class="keyword">&lt;tt&gt;</span><span class="comment">Interval2D</span><span class="keyword">&lt;/tt&gt;</span><span class="comment"> data type.</span>
<span class="comment">     */</span>
<span class="normal">    </span><span class="keyword">public</span><span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="type">void</span><span class="normal"> </span><span class="function">main</span><span class="symbol">(</span><span class="normal">String</span><span class="symbol">[]</span><span class="normal"> args</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">        </span><span class="type">double</span><span class="normal"> xlo </span><span class="symbol">=</span><span class="normal"> Double</span><span class="symbol">.</span><span class="function">parseDouble</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">[</span><span class="number">0</span><span class="symbol">]);</span>
<span class="normal">        </span><span class="type">double</span><span class="normal"> xhi </span><span class="symbol">=</span><span class="normal"> Double</span><span class="symbol">.</span><span class="function">parseDouble</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">[</span><span class="number">1</span><span class="symbol">]);</span>
<span class="normal">        </span><span class="type">double</span><span class="normal"> ylo </span><span class="symbol">=</span><span class="normal"> Double</span><span class="symbol">.</span><span class="function">parseDouble</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">[</span><span class="number">2</span><span class="symbol">]);</span>
<span class="normal">        </span><span class="type">double</span><span class="normal"> yhi </span><span class="symbol">=</span><span class="normal"> Double</span><span class="symbol">.</span><span class="function">parseDouble</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">[</span><span class="number">3</span><span class="symbol">]);</span>
<span class="normal">        </span><span class="type">int</span><span class="normal"> T </span><span class="symbol">=</span><span class="normal"> Integer</span><span class="symbol">.</span><span class="function">parseInt</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">[</span><span class="number">4</span><span class="symbol">]);</span>

<span class="normal">        </span><span class="usertype">Interval1D</span><span class="normal"> xinterval </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">new</span><span class="normal"> </span><span class="function">Interval1D</span><span class="symbol">(</span><span class="normal">xlo</span><span class="symbol">,</span><span class="normal"> xhi</span><span class="symbol">);</span>
<span class="normal">        </span><span class="usertype">Interval1D</span><span class="normal"> yinterval </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">new</span><span class="normal"> </span><span class="function">Interval1D</span><span class="symbol">(</span><span class="normal">ylo</span><span class="symbol">,</span><span class="normal"> yhi</span><span class="symbol">);</span>
<span class="normal">        </span><span class="usertype">Interval2D</span><span class="normal"> box </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">new</span><span class="normal"> </span><span class="function">Interval2D</span><span class="symbol">(</span><span class="normal">xinterval</span><span class="symbol">,</span><span class="normal"> yinterval</span><span class="symbol">);</span>
<span class="normal">        box</span><span class="symbol">.</span><span class="function">draw</span><span class="symbol">();</span>

<span class="normal">        </span><span class="usertype">Counter</span><span class="normal"> counter </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">new</span><span class="normal"> </span><span class="function">Counter</span><span class="symbol">(</span><span class="string">"hits"</span><span class="symbol">);</span>
<span class="normal">        </span><span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> t </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span><span class="normal"> t </span><span class="symbol">&lt;</span><span class="normal"> T</span><span class="symbol">;</span><span class="normal"> t</span><span class="symbol">++)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal">            </span><span class="type">double</span><span class="normal"> x </span><span class="symbol">=</span><span class="normal"> StdRandom</span><span class="symbol">.</span><span class="function">uniform</span><span class="symbol">(</span><span class="number">0.0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1.0</span><span class="symbol">);</span>
<span class="normal">            </span><span class="type">double</span><span class="normal"> y </span><span class="symbol">=</span><span class="normal"> StdRandom</span><span class="symbol">.</span><span class="function">uniform</span><span class="symbol">(</span><span class="number">0.0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1.0</span><span class="symbol">);</span>
<span class="normal">            </span><span class="usertype">Point2D</span><span class="normal"> p </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">new</span><span class="normal"> </span><span class="function">Point2D</span><span class="symbol">(</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">);</span>

<span class="normal">            </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">box</span><span class="symbol">.</span><span class="function">contains</span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">))</span><span class="normal"> counter</span><span class="symbol">.</span><span class="function">increment</span><span class="symbol">();</span>
<span class="normal">            </span><span class="keyword">else</span><span class="normal">                 p</span><span class="symbol">.</span><span class="function">draw</span><span class="symbol">();</span>
<span class="normal">        </span><span class="cbracket">}</span>

<span class="normal">        StdOut</span><span class="symbol">.</span><span class="function">println</span><span class="symbol">(</span><span class="normal">counter</span><span class="symbol">);</span>
<span class="normal">        StdOut</span><span class="symbol">.</span><span class="function">printf</span><span class="symbol">(</span><span class="string">"box area = %.2f</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> box</span><span class="symbol">.</span><span class="function">area</span><span class="symbol">());</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="comment">/******************************************************************************</span>
<span class="comment"> *  Copyright 2002-2015, Robert Sedgewick and Kevin Wayne.</span>
<span class="comment"> *</span>
<span class="comment"> *  This file is part of algs4.jar, which accompanies the textbook</span>
<span class="comment"> *</span>
<span class="comment"> *      Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne,</span>
<span class="comment"> *      Addison-Wesley Professional, 2011, ISBN 0-321-57351-X.</span>
<span class="comment"> *      </span><span class="url">http://algs4.cs.princeton.edu</span>
<span class="comment"> *</span>
<span class="comment"> *</span>
<span class="comment"> *  algs4.jar is free software: you can redistribute it and/or modify</span>
<span class="comment"> *  it under the terms of the GNU General Public License as published by</span>
<span class="comment"> *  the Free Software Foundation, either version 3 of the License, or</span>
<span class="comment"> *  (at your option) any later version.</span>
<span class="comment"> *</span>
<span class="comment"> *  algs4.jar is distributed in the hope that it will be useful,</span>
<span class="comment"> *  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="comment"> *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span class="comment"> *  GNU General Public License for more details.</span>
<span class="comment"> *</span>
<span class="comment"> *  You should have received a copy of the GNU General Public License</span>
<span class="comment"> *  along with algs4.jar.  If not, see </span><span class="url">http://www.gnu.org/licenses.</span>
<span class="comment"> ******************************************************************************/</span>
</tt></pre>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10811519-2");
pageTracker._trackPageview();
} catch(err) {}</script>

</body>

<p><br><address><small>
Last updated: Mon Mar 21 10:51:08 EDT 2016.
</small></address>

</html>
